home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
151-175
/
170
/
dis6502
/
initopts.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
929b
|
54 lines
/*
*
* dis [-p predefineds] file
*
* The -p option may be repeated.
*/
#include "dis.h"
char *predef[NPREDEF];
int npredef = 0;
char *file;
char *progname = "dis";
int bopt = 0;
initopts(argc,argv)
int argc;
char *argv[];
{
int ai;
char *ca;
int fileset = 0;
progname = argv[0];
while (--argc) {
if ((*++argv)[0] == '-') {
ca = *argv;
for(ai = 1; ca[ai] != '\0'; ai++)
switch (ca[ai]) {
case 'p':
predef[npredef] = *++argv;
npredef++;
argc--;
break;
case 'b':
bopt = 1;
break;
case 'c':
bopt = 2;
break;
default: crash("Invalid option letter");
}
} else if (!fileset) {
file = *argv;
fileset++;
} else crash("Usage: [-{c|b}] [-p predef] file");
}
if (!fileset)
crash("Usage: [-{c|b}] [-p predef] file");
}